package kusterordonio.interfaz;

import java.awt.Color;
import java.awt.event.KeyEvent;
import java.util.*;
import java.text.*;
import javax.swing.JCheckBox;
import javax.swing.JOptionPane;
import kusterordonio.dominio.*;

public class VentanaVacunas extends javax.swing.JFrame {

    private SistemaCarne modelo;
    private Ninio niño;
    private boolean caso;
    private FuncionesAuxiliares funcAux;
    
    /** Creates new form VentanaVacunas */
    public VentanaVacunas() {
        initComponents();
    }

    public VentanaVacunas(SistemaCarne unSistema, Ninio unNiño, boolean unCaso, FuncionesAuxiliares unaFunc) {
        modelo = unSistema;
        niño = unNiño;
        caso = unCaso;
        funcAux = unaFunc;
        initComponents();
        controlGenero();
        controlCaso();
        cargarVacunas();
        cargarFechas();
        cargarEdades();
        jLabelCambio.setVisible(false);
        jLabelErrores.setVisible(false);
        jDateAntigripal.setMaxSelectableDate(Calendar.getInstance().getTime());
        jDateMeningo.setMaxSelectableDate(Calendar.getInstance().getTime());
        jDateOtras.setMaxSelectableDate(Calendar.getInstance().getTime());
        jDateAntigripal.setMinSelectableDate(niño.getFechaNac());
        jDateMeningo.setMinSelectableDate(niño.getFechaNac());
        jDateOtras.setMinSelectableDate(niño.getFechaNac());
        jBtnSalir.setMnemonic(KeyEvent.VK_S);
        jBtnConfirmar.setMnemonic(KeyEvent.VK_C);
    }
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabelTitulo = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jTextVacunas = new javax.swing.JTextField();
        jTextBcg = new javax.swing.JTextField();
        jTextPenta = new javax.swing.JTextField();
        jTextBacte = new javax.swing.JTextField();
        jTextPolio = new javax.swing.JTextField();
        jTextNeumo = new javax.swing.JTextField();
        jTextViral = new javax.swing.JTextField();
        jTextVaricela = new javax.swing.JTextField();
        jTextHepaA = new javax.swing.JTextField();
        jTextDoble = new javax.swing.JTextField();
        jTextHepaB = new javax.swing.JTextField();
        jTextMeses = new javax.swing.JTextField();
        jTextAños = new javax.swing.JTextField();
        jTextMes1 = new javax.swing.JTextField();
        jTextMes2 = new javax.swing.JTextField();
        jTextMes3 = new javax.swing.JTextField();
        jTextMes4 = new javax.swing.JTextField();
        jTextMes5 = new javax.swing.JTextField();
        jTextMes6 = new javax.swing.JTextField();
        jTextMes7 = new javax.swing.JTextField();
        jTextMes8 = new javax.swing.JTextField();
        jTextMes9 = new javax.swing.JTextField();
        jTextMes10 = new javax.swing.JTextField();
        jTextAño1 = new javax.swing.JTextField();
        jTextAño2 = new javax.swing.JTextField();
        jTextAño3 = new javax.swing.JTextField();
        jCheckBcg0 = new javax.swing.JCheckBox();
        jCheckPenta2 = new javax.swing.JCheckBox();
        jCheckPenta4 = new javax.swing.JCheckBox();
        jCheckPenta6 = new javax.swing.JCheckBox();
        jCheckPenta15 = new javax.swing.JCheckBox();
        jCheckBacte5 = new javax.swing.JCheckBox();
        jCheckPolio2 = new javax.swing.JCheckBox();
        jCheckPolio4 = new javax.swing.JCheckBox();
        jCheckPolio6 = new javax.swing.JCheckBox();
        jCheckPolio12 = new javax.swing.JCheckBox();
        jCheckNeumo2 = new javax.swing.JCheckBox();
        jCheckNeumo4 = new javax.swing.JCheckBox();
        jCheckNeumo12 = new javax.swing.JCheckBox();
        jCheckViral12 = new javax.swing.JCheckBox();
        jCheckViral5 = new javax.swing.JCheckBox();
        jCheckVari12 = new javax.swing.JCheckBox();
        jCheckHepaA15 = new javax.swing.JCheckBox();
        jCheckHepaA21 = new javax.swing.JCheckBox();
        jCheckDoble12 = new javax.swing.JCheckBox();
        jCheckDobleC10 = new javax.swing.JCheckBox();
        jCheckHepaB12 = new javax.swing.JCheckBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jLabel2 = new javax.swing.JLabel();
        jTextVacunas2 = new javax.swing.JTextField();
        jTextAntiG = new javax.swing.JTextField();
        jTextAntiM = new javax.swing.JTextField();
        jTextOtras = new javax.swing.JTextField();
        jTextFecha = new javax.swing.JTextField();
        jTextEdad = new javax.swing.JTextField();
        jBtnSalir = new javax.swing.JButton();
        jBtnConfirmar = new javax.swing.JButton();
        jDateAntigripal = new com.toedter.calendar.JDateChooser();
        jLabelAntigripal = new javax.swing.JLabel();
        jDateMeningo = new com.toedter.calendar.JDateChooser();
        jLabelMeningo = new javax.swing.JLabel();
        jDateOtras = new com.toedter.calendar.JDateChooser();
        jLabelOtras = new javax.swing.JLabel();
        jLabelCambio = new javax.swing.JLabel();
        JLabelFecha = new javax.swing.JLabel();
        jLabelErrores = new javax.swing.JLabel();
        jLabelEdad1 = new javax.swing.JLabel();
        jLabelEdad2 = new javax.swing.JLabel();
        jLabelEdad3 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Vacunas");
        setAlwaysOnTop(true);
        setBounds(new java.awt.Rectangle(200, 100, 0, 0));
        setResizable(false);

        jPanel1.setName("Vacunas"); // NOI18N
        jPanel1.setLayout(null);

        jLabelTitulo.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabelTitulo.setForeground(new java.awt.Color(51, 153, 0));
        jLabelTitulo.setText("Vacunas");
        jPanel1.add(jLabelTitulo);
        jLabelTitulo.setBounds(20, 20, 120, 20);
        jPanel1.add(jSeparator1);
        jSeparator1.setBounds(0, 50, 600, 2);

        jTextVacunas.setBackground(new java.awt.Color(51, 153, 0));
        jTextVacunas.setEditable(false);
        jTextVacunas.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextVacunas.setForeground(new java.awt.Color(255, 255, 255));
        jTextVacunas.setText("Vacunas obligatorias");
        jPanel1.add(jTextVacunas);
        jTextVacunas.setBounds(30, 70, 180, 20);

        jTextBcg.setBackground(new java.awt.Color(51, 153, 0));
        jTextBcg.setEditable(false);
        jTextBcg.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextBcg.setForeground(new java.awt.Color(255, 255, 255));
        jTextBcg.setText("BCG");
        jPanel1.add(jTextBcg);
        jTextBcg.setBounds(30, 110, 180, 20);

        jTextPenta.setBackground(new java.awt.Color(153, 204, 0));
        jTextPenta.setEditable(false);
        jTextPenta.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextPenta.setForeground(new java.awt.Color(255, 255, 255));
        jTextPenta.setText("Pentavalente (*)");
        jPanel1.add(jTextPenta);
        jTextPenta.setBounds(30, 130, 180, 20);

        jTextBacte.setBackground(new java.awt.Color(51, 153, 0));
        jTextBacte.setEditable(false);
        jTextBacte.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextBacte.setForeground(new java.awt.Color(255, 255, 255));
        jTextBacte.setText("Triple bacteriana (**)");
        jPanel1.add(jTextBacte);
        jTextBacte.setBounds(30, 150, 180, 20);

        jTextPolio.setBackground(new java.awt.Color(153, 204, 0));
        jTextPolio.setEditable(false);
        jTextPolio.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextPolio.setForeground(new java.awt.Color(255, 255, 255));
        jTextPolio.setText("Polio OPV");
        jPanel1.add(jTextPolio);
        jTextPolio.setBounds(30, 170, 180, 20);

        jTextNeumo.setBackground(new java.awt.Color(51, 153, 0));
        jTextNeumo.setEditable(false);
        jTextNeumo.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextNeumo.setForeground(new java.awt.Color(255, 255, 255));
        jTextNeumo.setText("Neumococo C 7 V");
        jPanel1.add(jTextNeumo);
        jTextNeumo.setBounds(30, 190, 180, 20);

        jTextViral.setBackground(new java.awt.Color(153, 204, 0));
        jTextViral.setEditable(false);
        jTextViral.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextViral.setForeground(new java.awt.Color(255, 255, 255));
        jTextViral.setText("Triple viral");
        jPanel1.add(jTextViral);
        jTextViral.setBounds(30, 210, 180, 20);

        jTextVaricela.setBackground(new java.awt.Color(51, 153, 0));
        jTextVaricela.setEditable(false);
        jTextVaricela.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextVaricela.setForeground(new java.awt.Color(255, 255, 255));
        jTextVaricela.setText("Varicela");
        jPanel1.add(jTextVaricela);
        jTextVaricela.setBounds(30, 230, 180, 20);

        jTextHepaA.setBackground(new java.awt.Color(153, 204, 0));
        jTextHepaA.setEditable(false);
        jTextHepaA.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextHepaA.setForeground(new java.awt.Color(255, 255, 255));
        jTextHepaA.setText("Hepatitis A");
        jPanel1.add(jTextHepaA);
        jTextHepaA.setBounds(30, 250, 180, 20);

        jTextDoble.setBackground(new java.awt.Color(51, 153, 0));
        jTextDoble.setEditable(false);
        jTextDoble.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextDoble.setForeground(new java.awt.Color(255, 255, 255));
        jTextDoble.setText("Doble bacteriana (***)(1)");
        jPanel1.add(jTextDoble);
        jTextDoble.setBounds(30, 270, 180, 20);

        jTextHepaB.setBackground(new java.awt.Color(153, 204, 0));
        jTextHepaB.setEditable(false);
        jTextHepaB.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextHepaB.setForeground(new java.awt.Color(255, 255, 255));
        jTextHepaB.setText("Hepatitis B");
        jPanel1.add(jTextHepaB);
        jTextHepaB.setBounds(30, 290, 180, 20);

        jTextMeses.setBackground(new java.awt.Color(153, 204, 0));
        jTextMeses.setEditable(false);
        jTextMeses.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextMeses.setForeground(new java.awt.Color(255, 255, 255));
        jTextMeses.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextMeses.setText("Edad en meses");
        jPanel1.add(jTextMeses);
        jTextMeses.setBounds(210, 70, 200, 20);

        jTextAños.setBackground(new java.awt.Color(153, 204, 0));
        jTextAños.setEditable(false);
        jTextAños.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextAños.setForeground(new java.awt.Color(255, 255, 255));
        jTextAños.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextAños.setText("Edad en años");
        jPanel1.add(jTextAños);
        jTextAños.setBounds(420, 70, 120, 20);

        jTextMes1.setEditable(false);
        jTextMes1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextMes1.setText("0");
        jPanel1.add(jTextMes1);
        jTextMes1.setBounds(210, 90, 20, 20);

        jTextMes2.setEditable(false);
        jTextMes2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextMes2.setText("1");
        jPanel1.add(jTextMes2);
        jTextMes2.setBounds(230, 90, 20, 20);

        jTextMes3.setEditable(false);
        jTextMes3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextMes3.setText("2");
        jPanel1.add(jTextMes3);
        jTextMes3.setBounds(250, 90, 20, 20);

        jTextMes4.setEditable(false);
        jTextMes4.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextMes4.setText("3");
        jPanel1.add(jTextMes4);
        jTextMes4.setBounds(270, 90, 20, 20);

        jTextMes5.setEditable(false);
        jTextMes5.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextMes5.setText("4");
        jPanel1.add(jTextMes5);
        jTextMes5.setBounds(290, 90, 20, 20);

        jTextMes6.setEditable(false);
        jTextMes6.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextMes6.setText("5");
        jPanel1.add(jTextMes6);
        jTextMes6.setBounds(310, 90, 20, 20);

        jTextMes7.setEditable(false);
        jTextMes7.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextMes7.setText("6");
        jPanel1.add(jTextMes7);
        jTextMes7.setBounds(330, 90, 20, 20);

        jTextMes8.setEditable(false);
        jTextMes8.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextMes8.setText("12");
        jPanel1.add(jTextMes8);
        jTextMes8.setBounds(350, 90, 20, 20);

        jTextMes9.setEditable(false);
        jTextMes9.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextMes9.setText("15");
        jPanel1.add(jTextMes9);
        jTextMes9.setBounds(370, 90, 20, 20);

        jTextMes10.setEditable(false);
        jTextMes10.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextMes10.setText("21");
        jPanel1.add(jTextMes10);
        jTextMes10.setBounds(390, 90, 20, 20);

        jTextAño1.setEditable(false);
        jTextAño1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextAño1.setText("5");
        jPanel1.add(jTextAño1);
        jTextAño1.setBounds(420, 90, 40, 20);

        jTextAño2.setEditable(false);
        jTextAño2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextAño2.setText("12");
        jPanel1.add(jTextAño2);
        jTextAño2.setBounds(460, 90, 40, 20);

        jTextAño3.setEditable(false);
        jTextAño3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextAño3.setText("c/10");
        jPanel1.add(jTextAño3);
        jTextAño3.setBounds(500, 90, 40, 20);

        jCheckBcg0.setBackground(new java.awt.Color(51, 153, 0));
        jPanel1.add(jCheckBcg0);
        jCheckBcg0.setBounds(210, 110, 20, 21);

        jCheckPenta2.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckPenta2);
        jCheckPenta2.setBounds(250, 130, 20, 21);

        jCheckPenta4.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckPenta4);
        jCheckPenta4.setBounds(290, 130, 20, 21);

        jCheckPenta6.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckPenta6);
        jCheckPenta6.setBounds(330, 130, 20, 21);

        jCheckPenta15.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckPenta15);
        jCheckPenta15.setBounds(370, 130, 20, 21);

        jCheckBacte5.setBackground(new java.awt.Color(51, 153, 0));
        jPanel1.add(jCheckBacte5);
        jCheckBacte5.setBounds(430, 150, 20, 21);

        jCheckPolio2.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckPolio2);
        jCheckPolio2.setBounds(250, 170, 20, 21);

        jCheckPolio4.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckPolio4);
        jCheckPolio4.setBounds(290, 170, 20, 21);

        jCheckPolio6.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckPolio6);
        jCheckPolio6.setBounds(330, 170, 20, 21);

        jCheckPolio12.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckPolio12);
        jCheckPolio12.setBounds(350, 170, 20, 21);

        jCheckNeumo2.setBackground(new java.awt.Color(51, 153, 0));
        jPanel1.add(jCheckNeumo2);
        jCheckNeumo2.setBounds(250, 190, 20, 21);

        jCheckNeumo4.setBackground(new java.awt.Color(51, 153, 0));
        jPanel1.add(jCheckNeumo4);
        jCheckNeumo4.setBounds(290, 190, 20, 21);

        jCheckNeumo12.setBackground(new java.awt.Color(51, 153, 0));
        jPanel1.add(jCheckNeumo12);
        jCheckNeumo12.setBounds(350, 190, 20, 21);

        jCheckViral12.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckViral12);
        jCheckViral12.setBounds(350, 210, 20, 21);

        jCheckViral5.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckViral5);
        jCheckViral5.setBounds(430, 210, 20, 21);

        jCheckVari12.setBackground(new java.awt.Color(51, 153, 0));
        jPanel1.add(jCheckVari12);
        jCheckVari12.setBounds(350, 230, 20, 21);

        jCheckHepaA15.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckHepaA15);
        jCheckHepaA15.setBounds(370, 250, 20, 21);

        jCheckHepaA21.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckHepaA21);
        jCheckHepaA21.setBounds(390, 250, 20, 21);

        jCheckDoble12.setBackground(new java.awt.Color(51, 153, 0));
        jPanel1.add(jCheckDoble12);
        jCheckDoble12.setBounds(480, 270, 20, 21);

        jCheckDobleC10.setBackground(new java.awt.Color(51, 153, 0));
        jPanel1.add(jCheckDobleC10);
        jCheckDobleC10.setBounds(510, 270, 20, 21);

        jCheckHepaB12.setBackground(new java.awt.Color(153, 204, 0));
        jPanel1.add(jCheckHepaB12);
        jCheckHepaB12.setBounds(480, 290, 20, 21);

        jTextArea1.setColumns(4);
        jTextArea1.setEditable(false);
        jTextArea1.setFont(new java.awt.Font("Tahoma", 0, 9));
        jTextArea1.setRows(5);
        jTextArea1.setText("(*)     Pentavalente: DPT (Difteria, Pertussis, Tétanos), Hepatitis B, Haemophilius influenzae B\n(**)   DPT\n(***) DT (Difteria, Tétanos)\n(1) Embarazadas, refuerzo  (2) Vacunación contra hepatitis B a los 12 años de edad a niños no vacunados previamente");
        jScrollPane1.setViewportView(jTextArea1);

        jPanel1.add(jScrollPane1);
        jScrollPane1.setBounds(30, 330, 520, 78);

        jLabel2.setText("(2)");
        jPanel1.add(jLabel2);
        jLabel2.setBounds(460, 290, 20, 20);

        jTextVacunas2.setBackground(new java.awt.Color(51, 153, 0));
        jTextVacunas2.setEditable(false);
        jTextVacunas2.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextVacunas2.setForeground(new java.awt.Color(255, 255, 255));
        jTextVacunas2.setText("Vacunas no sistémicas");
        jPanel1.add(jTextVacunas2);
        jTextVacunas2.setBounds(30, 410, 180, 20);

        jTextAntiG.setBackground(new java.awt.Color(51, 153, 0));
        jTextAntiG.setEditable(false);
        jTextAntiG.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextAntiG.setForeground(new java.awt.Color(255, 255, 255));
        jTextAntiG.setText("Antigripal");
        jPanel1.add(jTextAntiG);
        jTextAntiG.setBounds(30, 430, 180, 20);

        jTextAntiM.setBackground(new java.awt.Color(51, 153, 0));
        jTextAntiM.setEditable(false);
        jTextAntiM.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextAntiM.setForeground(new java.awt.Color(255, 255, 255));
        jTextAntiM.setText("Anti - Meningococo");
        jPanel1.add(jTextAntiM);
        jTextAntiM.setBounds(30, 450, 180, 20);

        jTextOtras.setBackground(new java.awt.Color(51, 153, 0));
        jTextOtras.setEditable(false);
        jTextOtras.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextOtras.setForeground(new java.awt.Color(255, 255, 255));
        jTextOtras.setText("Otras");
        jPanel1.add(jTextOtras);
        jTextOtras.setBounds(30, 470, 180, 20);

        jTextFecha.setBackground(new java.awt.Color(153, 204, 0));
        jTextFecha.setEditable(false);
        jTextFecha.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextFecha.setForeground(new java.awt.Color(255, 255, 255));
        jTextFecha.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextFecha.setText("Fecha");
        jPanel1.add(jTextFecha);
        jTextFecha.setBounds(210, 410, 170, 20);

        jTextEdad.setBackground(new java.awt.Color(153, 204, 0));
        jTextEdad.setEditable(false);
        jTextEdad.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextEdad.setForeground(new java.awt.Color(255, 255, 255));
        jTextEdad.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextEdad.setText("Edad");
        jPanel1.add(jTextEdad);
        jTextEdad.setBounds(380, 410, 170, 20);

        jBtnSalir.setText("Salir");
        jBtnSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnSalirActionPerformed(evt);
            }
        });
        jPanel1.add(jBtnSalir);
        jBtnSalir.setBounds(350, 530, 140, 23);

        jBtnConfirmar.setText("Confirmar cambios");
        jBtnConfirmar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                jBtnConfirmarMouseExited(evt);
            }
        });
        jBtnConfirmar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnConfirmarActionPerformed(evt);
            }
        });
        jPanel1.add(jBtnConfirmar);
        jBtnConfirmar.setBounds(120, 530, 160, 23);

        jDateAntigripal.setDateFormatString("dd/MM/yyyy");
        jPanel1.add(jDateAntigripal);
        jDateAntigripal.setBounds(210, 430, 170, 20);

        jLabelAntigripal.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelAntigripal.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.add(jLabelAntigripal);
        jLabelAntigripal.setBounds(210, 430, 170, 20);

        jDateMeningo.setDateFormatString("dd/MM/yyyy");
        jPanel1.add(jDateMeningo);
        jDateMeningo.setBounds(210, 450, 170, 20);

        jLabelMeningo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelMeningo.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.add(jLabelMeningo);
        jLabelMeningo.setBounds(210, 450, 170, 20);

        jDateOtras.setDateFormatString("dd/MM/yyyy");
        jPanel1.add(jDateOtras);
        jDateOtras.setBounds(210, 470, 170, 20);

        jLabelOtras.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelOtras.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.add(jLabelOtras);
        jLabelOtras.setBounds(210, 470, 170, 20);

        jLabelCambio.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabelCambio.setText("El cambio se ha realizado");
        jPanel1.add(jLabelCambio);
        jLabelCambio.setBounds(130, 500, 180, 14);

        JLabelFecha.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                JLabelFechaMouseEntered(evt);
            }
        });
        jPanel1.add(JLabelFecha);
        JLabelFecha.setBounds(200, 410, 190, 90);

        jLabelErrores.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabelErrores.setForeground(new java.awt.Color(255, 0, 0));
        jLabelErrores.setText("No se han guardado los datos marcados en rojo");
        jPanel1.add(jLabelErrores);
        jLabelErrores.setBounds(70, 500, 300, 14);

        jLabelEdad1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelEdad1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.add(jLabelEdad1);
        jLabelEdad1.setBounds(380, 430, 170, 20);

        jLabelEdad2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelEdad2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.add(jLabelEdad2);
        jLabelEdad2.setBounds(380, 450, 170, 20);

        jLabelEdad3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelEdad3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.add(jLabelEdad3);
        jLabelEdad3.setBounds(380, 470, 170, 20);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 600, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 570, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public void controlCaso(){
        jDateAntigripal.setVisible(caso);
        jDateMeningo.setVisible(caso);
        jDateOtras.setVisible(caso);
        jCheckBacte5.setEnabled(caso);
        jCheckBcg0.setEnabled(caso);
        jCheckPenta2.setEnabled(caso);
        jCheckPenta4.setEnabled(caso);
        jCheckPenta6.setEnabled(caso);
        jCheckPenta15.setEnabled(caso);
        jCheckPolio2.setEnabled(caso);
        jCheckPolio4.setEnabled(caso);
        jCheckPolio6.setEnabled(caso);
        jCheckPolio12.setEnabled(caso);
        jCheckNeumo2.setEnabled(caso);
        jCheckNeumo4.setEnabled(caso);
        jCheckNeumo12.setEnabled(caso);
        jCheckViral12.setEnabled(caso);
        jCheckViral5.setEnabled(caso);
        jCheckVari12.setEnabled(caso);
        jCheckHepaA15.setEnabled(caso);
        jCheckHepaA21.setEnabled(caso);
        jCheckDoble12.setEnabled(caso);
        jCheckDobleC10.setEnabled(caso);
        jCheckHepaB12.setEnabled(caso);
        jBtnConfirmar.setVisible(caso);
    }
    
    public void cargarVacunas(){
        if(niño.getCarne().getVacunas().getVacunasObli()[0])funcAux.setearCheckBox(jCheckBcg0);
        if(niño.getCarne().getVacunas().getVacunasObli()[1])funcAux.setearCheckBox(jCheckPenta2);
        if(niño.getCarne().getVacunas().getVacunasObli()[2])funcAux.setearCheckBox(jCheckPenta4);
        if(niño.getCarne().getVacunas().getVacunasObli()[3])funcAux.setearCheckBox(jCheckPenta6);
        if(niño.getCarne().getVacunas().getVacunasObli()[4])funcAux.setearCheckBox(jCheckPenta15);
        if(niño.getCarne().getVacunas().getVacunasObli()[5])funcAux.setearCheckBox(jCheckBacte5);
        if(niño.getCarne().getVacunas().getVacunasObli()[6])funcAux.setearCheckBox(jCheckPolio2);
        if(niño.getCarne().getVacunas().getVacunasObli()[7])funcAux.setearCheckBox(jCheckPolio4);
        if(niño.getCarne().getVacunas().getVacunasObli()[8])funcAux.setearCheckBox(jCheckPolio6);
        if(niño.getCarne().getVacunas().getVacunasObli()[9])funcAux.setearCheckBox(jCheckPolio12);
        if(niño.getCarne().getVacunas().getVacunasObli()[10])funcAux.setearCheckBox(jCheckNeumo2);
        if(niño.getCarne().getVacunas().getVacunasObli()[11])funcAux.setearCheckBox(jCheckNeumo4);
        if(niño.getCarne().getVacunas().getVacunasObli()[12])funcAux.setearCheckBox(jCheckNeumo12);
        if(niño.getCarne().getVacunas().getVacunasObli()[13])funcAux.setearCheckBox(jCheckViral12);
        if(niño.getCarne().getVacunas().getVacunasObli()[14])funcAux.setearCheckBox(jCheckViral5);
        if(niño.getCarne().getVacunas().getVacunasObli()[15])funcAux.setearCheckBox(jCheckVari12);
        if(niño.getCarne().getVacunas().getVacunasObli()[16])funcAux.setearCheckBox(jCheckHepaA15);
        if(niño.getCarne().getVacunas().getVacunasObli()[17])funcAux.setearCheckBox(jCheckHepaA21);
        if(niño.getCarne().getVacunas().getVacunasObli()[18])funcAux.setearCheckBox(jCheckDoble12);
        if(niño.getCarne().getVacunas().getVacunasObli()[19])funcAux.setearCheckBox(jCheckDobleC10);
        if(niño.getCarne().getVacunas().getVacunasObli()[20])funcAux.setearCheckBox(jCheckHepaB12);
    }
    
    public void cargarFechas(){
        if(niño.getCarne().getVacunas().getFechaAntigripal()!= null){   
            this.jDateAntigripal.setDate(niño.getCarne().getVacunas().getFechaAntigripal());
            this.jDateAntigripal.setEnabled(false);
            this.jDateAntigripal.setVisible(false);
            SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy"); 
            this.jLabelAntigripal.setText(formato.format(niño.getCarne().getVacunas().getFechaAntigripal()));
        }
        if(niño.getCarne().getVacunas().getFechaAntiMeningB()!= null){   
            this.jDateMeningo.setDate(niño.getCarne().getVacunas().getFechaAntiMeningB());
            this.jDateMeningo.setEnabled(false);
            this.jDateMeningo.setVisible(false);
            SimpleDateFormat formato1 = new SimpleDateFormat("dd/MM/yyyy"); 
            this.jLabelMeningo.setText(formato1.format(niño.getCarne().getVacunas().getFechaAntiMeningB()));
        }  
        if(niño.getCarne().getVacunas().getFechaOtras()!= null){
            this.jDateOtras.setDate(niño.getCarne().getVacunas().getFechaOtras());
            this.jDateOtras.setEnabled(false);
            this.jDateOtras.setVisible(false);
            SimpleDateFormat formato2 = new SimpleDateFormat("dd/MM/yyyy"); 
            this.jLabelOtras.setText(formato2.format(niño.getCarne().getVacunas().getFechaOtras()));
        }
   }
    
   public void cargarEdades(){
        if(niño.getCarne().getVacunas().getEdadAntigripal()!= 0){
            jLabelEdad1.setText(funcAux.muestraEdad(niño.getCarne().getVacunas().getEdadAntigripal()));
        }
        if(niño.getCarne().getVacunas().getEdadAntiMeningB()!= 0){
            jLabelEdad2.setText(funcAux.muestraEdad(niño.getCarne().getVacunas().getEdadAntiMeningB()));
        }
        if(niño.getCarne().getVacunas().getEdadOtras()!= 0){
            jLabelEdad3.setText(funcAux.muestraEdad(niño.getCarne().getVacunas().getEdadOtras()));
        }
    }
    
    public void controlGenero(){
        if (!niño.isSexo()){
            jLabelTitulo.setForeground(new java.awt.Color(255, 153, 0));
            jTextVacunas.setBackground(new java.awt.Color(255, 153, 0));
            jTextBcg.setBackground(new java.awt.Color(255, 153, 0));
            jTextBacte.setBackground(new java.awt.Color(255, 153, 0));
            jTextNeumo.setBackground(new java.awt.Color(255, 153, 0));
            jTextVaricela.setBackground(new java.awt.Color(255, 153, 0));
            jTextDoble.setBackground(new java.awt.Color(255, 153, 0));
            jTextVacunas2.setBackground(new java.awt.Color(255, 153, 0));
            jTextAntiG.setBackground(new java.awt.Color(255, 153, 0));
            jTextAntiM.setBackground(new java.awt.Color(255, 153, 0));
            jTextOtras.setBackground(new java.awt.Color(255, 153, 0));
            jCheckBacte5.setBackground(new java.awt.Color(255, 153, 0));
            jCheckBcg0.setBackground(new java.awt.Color(255, 153, 0));
            jCheckNeumo2.setBackground(new java.awt.Color(255, 153, 0));
            jCheckNeumo4.setBackground(new java.awt.Color(255, 153, 0));
            jCheckNeumo12.setBackground(new java.awt.Color(255, 153, 0));
            jCheckVari12.setBackground(new java.awt.Color(255, 153, 0));
            jCheckDoble12.setBackground(new java.awt.Color(255, 153, 0));
            jCheckDobleC10.setBackground(new java.awt.Color(255, 153, 0));
            jTextPenta.setBackground(new java.awt.Color(255, 204, 153));
            jTextMeses.setBackground(new java.awt.Color(255, 204, 153));
            jTextAños.setBackground(new java.awt.Color(255, 204, 153));
            jCheckPenta2.setBackground(new java.awt.Color(255, 204, 153));
            jCheckPenta4.setBackground(new java.awt.Color(255, 204, 153));
            jCheckPenta6.setBackground(new java.awt.Color(255, 204, 153));
            jCheckPenta15.setBackground(new java.awt.Color(255, 204, 153));
            jCheckPolio2.setBackground(new java.awt.Color(255, 204, 153));
            jCheckPolio4.setBackground(new java.awt.Color(255, 204, 153));
            jCheckPolio6.setBackground(new java.awt.Color(255, 204, 153));
            jCheckPolio12.setBackground(new java.awt.Color(255, 204, 153));
            jCheckViral5.setBackground(new java.awt.Color(255, 204, 153));
            jCheckViral12.setBackground(new java.awt.Color(255, 204, 153));
            jCheckHepaA15.setBackground(new java.awt.Color(255, 204, 153));
            jCheckHepaA21.setBackground(new java.awt.Color(255, 204, 153));
            jCheckHepaB12.setBackground(new java.awt.Color(255, 204, 153));
            jTextFecha.setBackground(new java.awt.Color(255, 204, 153));
            jTextEdad.setBackground(new java.awt.Color(255, 204, 153));
            jTextPolio.setBackground(new java.awt.Color(255, 204, 153));
            jTextViral.setBackground(new java.awt.Color(255, 204, 153));
            jTextHepaA.setBackground(new java.awt.Color(255, 204, 153));
            jTextHepaB.setBackground(new java.awt.Color(255, 204, 153));
        }
    }
        
    private void jBtnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnSalirActionPerformed
        this.dispose();
    }//GEN-LAST:event_jBtnSalirActionPerformed

    private void jBtnConfirmarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnConfirmarActionPerformed
       //Setea las vacunas
       if(funcAux.verificarCheckBox(jCheckBcg0)) niño.getCarne().getVacunas().getVacunasObli()[0]= true;
       if(funcAux.verificarCheckBox(jCheckPenta2)) niño.getCarne().getVacunas().getVacunasObli()[1]= true;
       if(funcAux.verificarCheckBox(jCheckPenta4)) niño.getCarne().getVacunas().getVacunasObli()[2]= true;
       if(funcAux.verificarCheckBox(jCheckPenta6)) niño.getCarne().getVacunas().getVacunasObli()[3]= true;
       if(funcAux.verificarCheckBox(jCheckPenta15)) niño.getCarne().getVacunas().getVacunasObli()[4]= true;
       if(funcAux.verificarCheckBox(jCheckBacte5)) niño.getCarne().getVacunas().getVacunasObli()[5]= true;
       if(funcAux.verificarCheckBox(jCheckPolio2)) niño.getCarne().getVacunas().getVacunasObli()[6]= true;
       if(funcAux.verificarCheckBox(jCheckPolio4)) niño.getCarne().getVacunas().getVacunasObli()[7]= true;
       if(funcAux.verificarCheckBox(jCheckPolio6)) niño.getCarne().getVacunas().getVacunasObli()[8]= true;
       if(funcAux.verificarCheckBox(jCheckPolio12)) niño.getCarne().getVacunas().getVacunasObli()[9]= true;
       if(funcAux.verificarCheckBox(jCheckNeumo2)) niño.getCarne().getVacunas().getVacunasObli()[10]= true;
       if(funcAux.verificarCheckBox(jCheckNeumo4)) niño.getCarne().getVacunas().getVacunasObli()[11]= true;
       if(funcAux.verificarCheckBox(jCheckNeumo12)) niño.getCarne().getVacunas().getVacunasObli()[12]= true;
       if(funcAux.verificarCheckBox(jCheckViral12)) niño.getCarne().getVacunas().getVacunasObli()[13]= true;
       if(funcAux.verificarCheckBox(jCheckViral5)) niño.getCarne().getVacunas().getVacunasObli()[14]= true;
       if(funcAux.verificarCheckBox(jCheckVari12)) niño.getCarne().getVacunas().getVacunasObli()[15]= true;
       if(funcAux.verificarCheckBox(jCheckHepaA15)) niño.getCarne().getVacunas().getVacunasObli()[16]= true;
       if(funcAux.verificarCheckBox(jCheckHepaA21)) niño.getCarne().getVacunas().getVacunasObli()[17]= true;
       if(funcAux.verificarCheckBox(jCheckDoble12)) niño.getCarne().getVacunas().getVacunasObli()[18]= true;
       if(funcAux.verificarCheckBox(jCheckDobleC10)) niño.getCarne().getVacunas().getVacunasObli()[19]= true;
       if(funcAux.verificarCheckBox(jCheckHepaB12)) niño.getCarne().getVacunas().getVacunasObli()[20]= true;
       
       //Setea las fechas y edades de las vacunas
       if(jDateAntigripal.getDate()!= null){
           if(niño.controlFecha(jDateAntigripal.getDate())){
                niño.getCarne().getVacunas().setFechaAntigripal(this.jDateAntigripal.getDate());    
                niño.getCarne().getVacunas().setEdadAntigripal(niño.calculoEdad(jDateAntigripal.getDate()));
                jLabelEdad1.setText(funcAux.muestraEdad(niño.getCarne().getVacunas().getEdadAntigripal()));
           }else{
               jLabelErrores.setVisible(true);
           }
       }
       if(jDateMeningo.getDate()!= null){
           if(niño.controlFecha(jDateMeningo.getDate())){
                niño.getCarne().getVacunas().setFechaAntiMeningB(this.jDateMeningo.getDate()); 
                niño.getCarne().getVacunas().setEdadAntiMeningB(niño.calculoEdad(jDateMeningo.getDate()));
                jLabelEdad2.setText(funcAux.muestraEdad(niño.getCarne().getVacunas().getEdadAntiMeningB()));
           }else{
               jLabelErrores.setVisible(true);
           }
       }
       if(jDateOtras.getDate()!= null){
           if(niño.controlFecha(jDateOtras.getDate())){
                niño.getCarne().getVacunas().setFechaOtras(this.jDateOtras.getDate());  
                niño.getCarne().getVacunas().setEdadOtras(niño.calculoEdad(jDateOtras.getDate()));
                jLabelEdad3.setText(funcAux.muestraEdad(niño.getCarne().getVacunas().getEdadOtras()));
           }else{
               jLabelErrores.setVisible(true);
           }
       }
       if(!jLabelErrores.isVisible()){
           jLabelCambio.setVisible(true);
       }
       //JOptionPane.showMessageDialog(null,"El cambio se ha realizado", "OK", 1);     
    }//GEN-LAST:event_jBtnConfirmarActionPerformed

    private void jBtnConfirmarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBtnConfirmarMouseExited
        this.jLabelCambio.setVisible(false);
    }//GEN-LAST:event_jBtnConfirmarMouseExited

private void JLabelFechaMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JLabelFechaMouseEntered
     jLabelErrores.setVisible(false);
}//GEN-LAST:event_JLabelFechaMouseEntered

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel JLabelFecha;
    private javax.swing.JButton jBtnConfirmar;
    private javax.swing.JButton jBtnSalir;
    private javax.swing.JCheckBox jCheckBacte5;
    private javax.swing.JCheckBox jCheckBcg0;
    private javax.swing.JCheckBox jCheckDoble12;
    private javax.swing.JCheckBox jCheckDobleC10;
    private javax.swing.JCheckBox jCheckHepaA15;
    private javax.swing.JCheckBox jCheckHepaA21;
    private javax.swing.JCheckBox jCheckHepaB12;
    private javax.swing.JCheckBox jCheckNeumo12;
    private javax.swing.JCheckBox jCheckNeumo2;
    private javax.swing.JCheckBox jCheckNeumo4;
    private javax.swing.JCheckBox jCheckPenta15;
    private javax.swing.JCheckBox jCheckPenta2;
    private javax.swing.JCheckBox jCheckPenta4;
    private javax.swing.JCheckBox jCheckPenta6;
    private javax.swing.JCheckBox jCheckPolio12;
    private javax.swing.JCheckBox jCheckPolio2;
    private javax.swing.JCheckBox jCheckPolio4;
    private javax.swing.JCheckBox jCheckPolio6;
    private javax.swing.JCheckBox jCheckVari12;
    private javax.swing.JCheckBox jCheckViral12;
    private javax.swing.JCheckBox jCheckViral5;
    private com.toedter.calendar.JDateChooser jDateAntigripal;
    private com.toedter.calendar.JDateChooser jDateMeningo;
    private com.toedter.calendar.JDateChooser jDateOtras;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabelAntigripal;
    private javax.swing.JLabel jLabelCambio;
    private javax.swing.JLabel jLabelEdad1;
    private javax.swing.JLabel jLabelEdad2;
    private javax.swing.JLabel jLabelEdad3;
    private javax.swing.JLabel jLabelErrores;
    private javax.swing.JLabel jLabelMeningo;
    private javax.swing.JLabel jLabelOtras;
    private javax.swing.JLabel jLabelTitulo;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextField jTextAntiG;
    private javax.swing.JTextField jTextAntiM;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextAño1;
    private javax.swing.JTextField jTextAño2;
    private javax.swing.JTextField jTextAño3;
    private javax.swing.JTextField jTextAños;
    private javax.swing.JTextField jTextBacte;
    private javax.swing.JTextField jTextBcg;
    private javax.swing.JTextField jTextDoble;
    private javax.swing.JTextField jTextEdad;
    private javax.swing.JTextField jTextFecha;
    private javax.swing.JTextField jTextHepaA;
    private javax.swing.JTextField jTextHepaB;
    private javax.swing.JTextField jTextMes1;
    private javax.swing.JTextField jTextMes10;
    private javax.swing.JTextField jTextMes2;
    private javax.swing.JTextField jTextMes3;
    private javax.swing.JTextField jTextMes4;
    private javax.swing.JTextField jTextMes5;
    private javax.swing.JTextField jTextMes6;
    private javax.swing.JTextField jTextMes7;
    private javax.swing.JTextField jTextMes8;
    private javax.swing.JTextField jTextMes9;
    private javax.swing.JTextField jTextMeses;
    private javax.swing.JTextField jTextNeumo;
    private javax.swing.JTextField jTextOtras;
    private javax.swing.JTextField jTextPenta;
    private javax.swing.JTextField jTextPolio;
    private javax.swing.JTextField jTextVacunas;
    private javax.swing.JTextField jTextVacunas2;
    private javax.swing.JTextField jTextVaricela;
    private javax.swing.JTextField jTextViral;
    // End of variables declaration//GEN-END:variables
}
